package com.yan.ems.controller;

import com.yan.ems.pojo.entity.User;
import com.yan.ems.pojo.param.UserParam;
import com.yan.ems.pojo.vo.LoginVo;
import com.yan.ems.pojo.vo.Result;
import com.yan.ems.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class UserController {
	@Autowired
	private UserService userService;
	@RequestMapping("/user/login")
	public Result<LoginVo> login(@RequestBody UserParam userParam) {
		// 可以做合法校验
		return userService.login(userParam);
	}

	@RequestMapping("/user/register")
	public Result<Void> register(@RequestBody UserParam userParam) {
		// 可以做合法校验
		return userService.register(userParam);
	}
}
